const barConfig = {
  tooltip: {
    trigger: "axis",
    axisPointer: {
      type: "shadow"
    }
  },
  grid: {
    left: "3%",
    right: "4%",
    bottom: "3%",
    containLabel: true
  },
  xAxis: {
    type: "category",
    data: [],
    axisTick: {
      alignWithLabel: true
    }
  },
  yAxis: [
    {
      type: "value"
    }
  ],
  series: [
    {
      name: "Direct",
      type: "bar",
      barWidth: "60%",
      data: []
    }
  ]
};
const generateBarOptions = (data: any[]) => {
  const xAxis = Array.from(new Set(data.map(item => item.xAxis)));
  barConfig.xAxis.data = xAxis;
  barConfig.series[0].data = data;
  return barConfig;
};
export default generateBarOptions;
